import { request ,get} from '@/utils/axios'; // 引入封装后的 axios 方法


/**
 * @description - 封装考试类型的接口方法
 */
export class QuestionBankService {
  /**
   * @description 用户登录
   * @param {object} params - 登录参数
   * @return {Promise<any>} result
   */
  static async getQuestionBankPage(params: Record<string, any>): Promise<any> {
    return request('/api/question/questionBank/page', params, 'GET', true); // 不需要认证
  }



  /**
   * @description 获取考试信息
   *
    * @param {object} params - 请求参数
    * @return {Promise<any>} result
    */

  static async addQuestionBank(params: Record<string, any>): Promise<any> {
    return request('/api/question/questionBank', params, 'post', true); // 不需要认证
  }


    static async addQuestionBankBatch(params: Record<string, any>): Promise<any> {
    return request('/api/question/bank-questions/batch', params, 'post', true); // 不需要认证
  }

/**
   * @description 获取考试信息
   *
   * @param {object} params - 请求参数
   * @return {Promise<any>} result
   *
   *
   */

    static async updateQuestionBank(params: Record<string, any>): Promise<any> {
    return request('/api/question/questionBank', params, 'PUT', true); // 不需要认证
  }


  /**
   * @description 获取考试信息
   *
   * @param {object} params - 请求参数
   * @return {Promise<any>} result
   *
   *
   */

    static async getQuestionBankById(id:String , params: Record<string, any>): Promise<any> {
    return request(`/api/question/questionBank/${id}`, params, 'get', true); // 不需要认证
  }




  /**
   * @description 获取考试信息
    * @param {object} params - 请求参数
    * @return {Promise<any>} result
    *
    */

    static async deleteQuestionBank(  id:String , params: Record<string, any>): Promise<any> {
    return request(`/api/question/questionBank/${id}`, params, 'delete', true); // 不需要认证
  }

    static async queryQuestionBank(params: Record<string, any>): Promise<any> {
    return request('/api/question/questionBank/pageQuery', params, 'GET', true); // 不需要认证
  }

}


export class SubjectService {
  static async getSubjectPage(params: Record<string, any>): Promise<any> {
    return request('/api/question/subject/page', params, 'GET', true); // 不需要认证
  }
  static async getSubjectTree(params: Record<string, any>): Promise<any> {
    return request('/api/question/subject/tree', params, 'GET', true); // 不需要认证
  }
    static async getAllSubjects(params: Record<string, any>): Promise<any> {
    return request('/api/question/subject/list', params, 'get', true); // 不需要认证
  }
    static async getSubjectById(id:String , params: Record<string, any>): Promise<any> {
    return request(`/api/question/subject/${id}`, params, 'get', true); // 不需要认证
  }
    static async addSubject(params: Record<string, any>): Promise<any> {
    return request('/api/question/subject', params, 'post', true); // 不需要认证
  }

    static async updateSubject(params: Record<string, any>): Promise<any> {
    return request('/api/question/subject', params, 'put', true); // 不需要认证
  }
    static async deleteSubject(id:String ,params: Record<string, any>): Promise<any> {
    return request(`/api/question/subject/${id}`, params, 'delete', true); // 不需要认证
  }
}
